import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const querySysOrgInfo = (params) => {
  params.head.transCode = 'querySysOrgInfo';
  return request({
    url: '/platform/sysOrgInfo/querySysOrgInfo',
    method: 'post',
    data: params
  })
}

//单条查询
export const querySysOrgTree = (params) => {
  params.head.transCode = 'querySysOrgTree';
  return request({
    url: '/platform/sysOrgInfo/querySysOrgTree',
    method: 'post',
    data: params
  })
}

//多条列表查询，支持条件查询
export const querySysOrgInfoListPage = (params) => {
  params.head.transCode = 'querySysOrgInfoListPage';
  return request({
    url: '/platform/sysOrgInfo/querySysOrgInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysOrgInfo = (params) => {
  params.head.transCode = 'saveSysOrgInfo';
  return request({
    url: '/platform/sysOrgInfo/saveSysOrgInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveSysOrgInfoList = (params) => {
  params.head.transCode = 'saveSysOrgInfoList';
  return request({
    url: '/platform/sysOrgInfo/saveSysOrgInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysOrgInfo = (params) => {
  params.head.transCode = 'saveOrUpdateSysOrgInfo';
  return request({
    url: '/platform/sysOrgInfo/saveOrUpdateSysOrgInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysOrgInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateSysOrgInfoList';
  return request({
    url: '/platform/sysOrgInfo/saveOrUpdateSysOrgInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysOrgInfo = (params) => {
  params.head.transCode = 'updateSysOrgInfo';
  return request({
    url: '/platform/sysOrgInfo/updateSysOrgInfo',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteSysOrgInfo = (params) => {
  params.head.transCode = 'deleteSysOrgInfo';
  return request({
    url: '/platform/sysOrgInfo/deleteSysOrgInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysOrgInfoList = (params) => {
  params.head.transCode = 'deleteSysOrgInfoList';
  return request({
    url: '/platform/sysOrgInfo/deleteSysOrgInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportSysOrgInfoExcel = (params) => {
  downloadExcel({
    url: '/platform/sysOrgInfo/excelDownload/exportSysOrgInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
